<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script src="js/xlsx.full.min.js"></script>
    </head>
    <body>
        <input type="file"onchange="importf(this)" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
        <div id="demo"></div>
        <script>
            var wb;//读取完成的数据

            var rABS = false; //是否将文件读取为二进制字符串


            function importf(obj) {//导入

			console.dir(obj);
                if(!obj.files) {
                    return;
                }
				
				
                var f = obj.files[0];
                var reader = new FileReader();
                reader.onload = function(e) {
                    var data = e.target.result;
                    if(rABS) {
                        wb = XLSX.read(btoa(fixdata(data)), {//手动转化

                            type: 'base64'
                        });
                    } else {
                        wb = XLSX.read(data, {
                            type: 'binary'
                        });
                    }
                    //wb.SheetNames[0]是获取Sheets中第一个Sheet的名字

                    //wb.Sheets[Sheet名]获取第一个Sheet的数据

                    //document.getElementById("demo").innerHTML= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
					var obj=wb.Sheets[wb.SheetNames[0]];
					// document.getElementById("demo").innerHTML=   JSON.stringify(obj); 
					console.dir(obj);
					var str="";
					for(var su in obj){
						// console.log(obj[su].v);
						var number=obj[su].v;
						if(number==undefined){
							continue;
						}
						str +=number+',';
					}
					console.log(str);
					// var qustr=filterRepeatStr(str.substring(0,str.length-1));
					// console.log(qustr);
					
                };
                if(rABS) {
                    reader.readAsArrayBuffer(f);
                } else {
                    reader.readAsBinaryString(f);
                   
                }
            }

           
			// function filterRepeatStr(str){
			// 	var ar2 = str.split(",");
			// 	var array = new Array();
			// 	var j=0
			// 	for(var i=0;i<ar2.length;i++){ 
			// 	if((array == "" || array.toString().match(new RegExp(ar2[i],"g")) == null)&&ar2[i]!=""){ 
			// 		array[j] =ar2[i]; 
			// 		array.sort();
			// 		j++;
			// 	}
			// 	}
			// 	return array.toString();
			// }
        </script>
    </body>
</html>
<!--
	
-->